package io;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) throws IOException {
       Scanner sc=new Scanner(System.in);


        System.out.println( "请输入内容");
        FileOutputStream fos=new FileOutputStream("fos.txt");
        String file=sc.nextLine();
        while (!"exit".equals(file)){
        byte[]data= file.getBytes(StandardCharsets.UTF_8);
        fos.write(data);

        file = sc.nextLine();
       }
        System.out.println("再见");
        fos.close();

      /* while(true){
           System.out.println( "请输入内容");
            String line = sc.nextLine();
            if("exit".equalsIgnoreCase(line)){
                break;
            }
            byte[] data = line.getBytes(StandardCharsets.UTF_8);
            fos.write(data);
        }
        System.out.println("再见");*/


        fos.close();
    }
    }


